Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-crypto/raw-rsa-keyring-node

Package Overview
Dependencies
Maintainers
8
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-crypto/raw-rsa-keyring-node

The AWS Encryption SDK for JavaScript is a client-side encryption library designed to make it easy for everyone to encrypt and decrypt data using industry standards and best practices. It uses a data format compatible with the AWS Encryption SDKs in other

  • 3.2.2
  • npm
  • Socket score

Version published
Maintainers
8
Created

What is @aws-crypto/raw-rsa-keyring-node?

@aws-crypto/raw-rsa-keyring-node is a package provided by AWS that allows you to use raw RSA keyrings for encryption and decryption operations. It is part of the AWS Encryption SDK for JavaScript, which provides tools for encrypting and decrypting data using various key management techniques.

What are @aws-crypto/raw-rsa-keyring-node's main functionalities?

Encrypting Data

This code demonstrates how to use the @aws-crypto/raw-rsa-keyring-node package to encrypt data using a raw RSA keyring. It generates an RSA key pair, creates a keyring, and then encrypts a plaintext message.

const { RawRsaKeyringNode, encrypt } = require('@aws-crypto/raw-rsa-keyring-node');
const { KeyPair } = require('crypto');

const keyPair = KeyPair.generateSync('rsa', {
  modulusLength: 2048,
});

const keyring = new RawRsaKeyringNode({
  keyName: 'my-key',
  keyNamespace: 'my-namespace',
  publicKey: keyPair.publicKey,
  privateKey: keyPair.privateKey,
});

const plaintext = Buffer.from('Hello, world!');

(async () => {
  const { result } = await encrypt(keyring, plaintext);
  console.log(result);
})();

Decrypting Data

This code demonstrates how to use the @aws-crypto/raw-rsa-keyring-node package to decrypt data using a raw RSA keyring. It generates an RSA key pair, creates a keyring, and then decrypts a ciphertext message.

const { RawRsaKeyringNode, decrypt } = require('@aws-crypto/raw-rsa-keyring-node');
const { KeyPair } = require('crypto');

const keyPair = KeyPair.generateSync('rsa', {
  modulusLength: 2048,
});

const keyring = new RawRsaKeyringNode({
  keyName: 'my-key',
  keyNamespace: 'my-namespace',
  publicKey: keyPair.publicKey,
  privateKey: keyPair.privateKey,
});

const ciphertext = Buffer.from('...'); // Replace with actual ciphertext

(async () => {
  const { plaintext } = await decrypt(keyring, ciphertext);
  console.log(plaintext.toString());
})();

Other packages similar to @aws-crypto/raw-rsa-keyring-node

FAQs

Package last updated on 05 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc